package org.huntaway.material.cleaner.enumerate;

/**
 * @author jskyme 操作类型枚举 支持的操作类型
 */
public enum EnumOperate {
	C("copy", "复制"), D("delete", "删除"), G("get", "获取"), M("move", "移动"), O(
			"open", "打开"), R("run", "运行"), S("show", "显示");
	private String code;
	private String label;

	private EnumOperate(String code, String label) {
		this.code = code;
		this.label = label;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public static EnumOperate getOperate(String str) {
		String oper = (str == null ? "h" : str.substring(0, 1));
		for (EnumOperate operate : EnumOperate.values()) {
			if (operate.name().toLowerCase().equals(oper)) {
				return operate;
			}
		}
		return null;
	}
}
